package com.dongdong.tbbrandService.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdong.mapper.TbBrandMapper;
import com.dongdong.pojo.TbBrand;
import com.dongdong.service.TbBrandService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
@org.springframework.stereotype.Service
public class TbBrandServiceImpl implements TbBrandService {
    @Autowired
    private TbBrandMapper tbBrandMapper;

    @Override
    public List<TbBrand> getShow() {

        return tbBrandMapper.selectByExample(null);
    }

    @Override
    public Boolean toAdd(TbBrand tbBrand) {
        int i = tbBrandMapper.insert(tbBrand);
        return i>0;
    }

    @Override
    public TbBrand toUpdate(Long id) {
        return tbBrandMapper.selectByPrimaryKey(id);
    }

    @Override
    public void updateInfo(TbBrand tbBrand) {
        tbBrandMapper.updateByPrimaryKeySelective(tbBrand);
    }

    @Override
    public Boolean deleteAll(Long[] ids) {
        int i = tbBrandMapper.deleteAll(ids);

        return i>0;
    }
}
